package cn.com.lyb.enums;



public enum WorkflowNodeType {
    /**
     * 任务节点
     */
    JOB(1,false),
    /**
     * 判断节点
     */
    DECISION(2,true),
    /**
     * 内嵌工作流
     */
    NESTED_WORKFLOW(3,false),

    ;

    private final int code;
    /**
     * 控制节点
     */
    private final boolean controlNode;

    WorkflowNodeType(int code, boolean controlNode) {
        this.code = code;
        this.controlNode = controlNode;
    }

    public static WorkflowNodeType of(int code) {
        for (WorkflowNodeType nodeType : values()) {
            if (nodeType.code == code) {
                return nodeType;
            }
        }
        throw new IllegalArgumentException("unknown WorkflowNodeType of " + code);
    }

    public int getCode() {
        return code;
    }

    public boolean isControlNode() {
        return controlNode;
    }
}
